package com.shop2cn.iapi.livebuyer.service;

import java.util.ArrayList;

import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.livebuyer.parameter.LiveRoomInfo;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*根据直播间Id批量查询直播间列表Call
*FreeMaker Template自动生成代码
*/
public class QueryAllLiveRoomCall extends YmatouBaseCall{
	private static String opurl ="api/QueryAllLiveRoom";
	
	public QueryAllLiveRoomCall() {
		super(EnvSetup.getSystemUrl("livebuyer_iapi_shop2cn"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	public ArrayList<LiveRoomInfo> getLiveRoomInfo()
    {
		ArrayList<LiveRoomInfo> data = null;
        try {
        	String liveroominfo=getJsonObject().get("data").getAsJsonObject().get("liveRoomList").getAsJsonArray().toString();
        	data=(ArrayList<LiveRoomInfo>) FormatUtil.GSONToObject(liveroominfo, new TypeToken<ArrayList<LiveRoomInfo>>() {}.getType());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
	public Integer getPageCount()
    {
		return getJsonObject().get("data").getAsJsonObject().get("pageCount").getAsInt();
    }
	public Integer getTotalCount()
    {
		return getJsonObject().get("data").getAsJsonObject().get("totalCount").getAsInt();
    }
}